import { takeEvery, put } from "redux-saga/effects"
import axios from "axios"
axios.defaults.baseURL = "https://www.fastmock.site/mock/5586d2ae69a56f5099340a4879428c60/imock/api"

function* loadArticles() {
  const { data } = yield axios.get("/articles")
  yield put({ type: "loadArticlesSuccess", payload: data.data })
}

export default function* articleSaga() {
  yield takeEvery("loadArticles", loadArticles)
}
